// src/api/activity.ts
import request from '@/utils/request';

// 获取渠道列表
export function getChannelList() {
    return request({
        url: '/tienchin/activity/channel/list',
        method: 'get'
    });
}

// 查询活动列表
export function listActivity(query: any) {
    return request({
        url: '/tienchin/activity/list',
        method: 'get',
        params: query
    });
}

// 获取活动详细信息
export function getActivity(activityId: number) {
    return request({
        url: `/tienchin/activity/${activityId}`,
        method: 'get'
    });
}

// 新增活动
export function addActivity(data: any) {
    return request({
        url: '/tienchin/activity',
        method: 'post',
        data: data
    });
}

// 修改活动
export function updateActivity(data: any) {
    return request({
        url: '/tienchin/activity',
        method: 'put',
        data: data
    });
}

// 删除活动
export function delActivity(activityId: number) {
    return request({
        url: `/tienchin/activity/${activityId}`,
        method: 'delete'
    });
}

// 批量删除活动
export function delActivityBatch(ids: string) {
    return request({
        url: `/tienchin/activity/${ids}`,
        method: 'delete'
    });
}

// 导出活动
export function exportActivity(query: any) {
    return request({
        url: '/tienchin/activity/export',
        method: 'post',
        params: query,
        responseType: 'blob'
    });
}